cmake_minimum_required(VERSION 3.2)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

# expected behaviour
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++lastest")

set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/ "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

set(ARROW_C "cc")
project(${ARROW_C} VERSION 1.0.0 LANGUAGES "CXX")


# list(APPEND CMAKE_INCLUDE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/src/include")

# message("--CMAKE_INCLUDE_PATH: ${CMAKE_INCLUDE_PATH}")
# message("--CMAKE_LIBRARY_PATH: ${CMAKE_LIBRARY_PATH}")

include_directories(src/include)
set(ARROW_C_SOURCE_FILES
    src/allocate_bytes.cc
    src/hello.cc
    src/table_write.cc
    src/arrow_fill.cc
    src/arrow_fill_c.cc
    src/arrow_fill_cc.cc
    )

set(ARROW_BUILD_FOLDER 
    # /codes/arrow/build
    /media/data/apache/arrow/build
    # /usr/local/lib
    )

set(ARROW_DEBUG_STATIC_LIBS
    ${ARROW_BUILD_FOLDER}/debug/libarrow.a 
    ${ARROW_BUILD_FOLDER}/debug/libarrow_bundled_dependencies.a 
    ${ARROW_BUILD_FOLDER}/debug/libarrow_dataset.a
    ${ARROW_BUILD_FOLDER}/jemalloc_ep-prefix/src/jemalloc_ep/lib/libjemalloc.a
    ${ARROW_BUILD_FOLDER}/jemalloc_ep-prefix/src/jemalloc_ep/lib/libjemalloc_pic.a
    )

add_library(arrow_c ${ARROW_C_SOURCE_FILES})
target_link_libraries(arrow_c  ${ARROW_DEBUG_STATIC_LIBS})

set(CMAKE_CXX_FLAGS -pthread)

add_executable(fill_int  src/arrow_fill.cc)
target_link_libraries(fill_int  ${ARROW_DEBUG_STATIC_LIBS})

add_executable(fill_test src/fill_cc_test.cc)
target_link_libraries(fill_test arrow_c ${ARROW_DEBUG_STATIC_LIBS})

